package com.guojizhuang.parititioner;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MonthMapper extends Mapper<LongWritable, Text, Text, Text> {
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
    {
        String[] str = value.toString().split(",");
        if (str.length!=4)
        {
            System.out.println("数据格式错误");
        }else {
            context.write(new Text(str[2]),value);
        }
    }
}
